
# update syslog-ng.conf on 3.xx updates
pkgname=syslog-ng
pkgver=3.16.1
pkgrel=1
pkgdesc="Next-generation syslogd with advanced networking and filtering capabilities"
arch=('x86_64')
license=('GPL2')
url="https://syslog-ng.com/"
depends=('glib2' 'eventlog' 'openssl' 'libcap' 'awk' 'systemd' 'json-c')
makedepends=('flex' 'pkg-config' 'python2' 'libxslt')
optdepends=('logrotate: for rotating log files')
provides=('logger')
options=('!libtool')
backup=('etc/syslog-ng/scl.conf'
        'etc/syslog-ng/syslog-ng.conf'
        'etc/logrotate.d/syslog-ng')
source=("https://github.com/balabit/syslog-ng/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz"
        'syslog-ng.conf'
        'syslog-ng.logrotate')
md5sums=('72d44ad02c2e9ba0748b3ecd3f15a7ff'
         '97cc5c856f408fc2f76b8afd0692938e'
         '0c0d5149bd3e8d666c506351edecbe71')

build() {
  cd ${pkgname}-${pkgver}

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc/syslog-ng \
    --libexecdir=/usr/lib \
    --localstatedir=/var/lib/syslog-ng \
    --datadir=/usr/share \
    --with-pidfile-dir=/run \
    --disable-spoof-source \
    --enable-systemd \
    --enable-ipv6 \
    --with-systemdsystemunitdir=/usr/lib/systemd/system \
    --with-python=2.7 \
    --with-jsonc=system

  make -j1
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  install -dm755 ${pkgdir}/var/lib/syslog-ng ${pkgdir}/etc/syslog-ng/patterndb.d
  #install -Dm644 ${srcdir}/syslog-ng.conf ${pkgdir}/etc/syslog-ng/syslog-ng.conf
  install -Dm644 ${srcdir}/syslog-ng.logrotate ${pkgdir}/etc/logrotate.d/syslog-ng
  #part of eventlog
  rm ${pkgdir}/usr/lib/libevtlog.so
}
